package com.sdu.game.websocket;

import com.sdu.game.wbr.game_play.ActFunction;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.websocket.Session;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;

@RestController
@CrossOrigin//告诉浏览器允许别的网站访问我
public class Playing {

    @Resource
    private GamePlay gamePlay;//用来调用websocket操作

    ConcurrentHashMap<String, Session> sessionList=gamePlay.getSessionPools();//当前游戏在线用户

    ConcurrentHashMap<String, String> userVoteList=gamePlay.getUservot();//当前游戏用户投票结果




    //改变房间的时间、白天、夜晚
    @RequestMapping("/zhilang/v1/game/playing/Day")
    public void RoomDay(int RoomID,int flag){
        //修改数据库中的房间时间

    }

    ActFunction af = new ActFunction();

    @RequestMapping("/zhilang/v1/game/playing/vote")
    public String vote(){

        String result = af.Action(userVoteList);

        return result;

    }


    //前端发送信息信号，将全部聊天信息推送到前端
    @RequestMapping("/zhilang/v1/game/playing/chat")
    public void chat(){


    }

}